{"componentChunkName":"component---src-pages-codes-js","path":"/codes/","webpackCompilationHash":"0f979b9b09e9513b4912","result":{"data":{"site":{"siteMetadata":{"keywords":["blog","ubug","tech blog","技术博客","playground"]}},"allMdx":{"edges":[{"node":{"fields":{"title":"✨ 偶尔收集的短代码 | Ubug","noFooter":false,"description":null,"date":"","author":"Ubug","banner":null,"bannerCredit":null,"slug":"codes","tags":[]},"headings":[{"value":"1. 根据 hex 背景颜色计算前景文字颜色","depth":2},{"value":"2. SSL","depth":2},{"value":"快速生成一个本地 SSL 证书用来调试","depth":3},{"value":"快速配置网站 SSL","depth":3},{"value":"3. canvas 圆角矩形、圆角图片、多行文字","depth":2},{"value":"4. 直接启动 AS 的模拟器","depth":2},{"value":"5. 直接静默启动 scrcpy，同时指定某个设备","depth":2},{"value":"6. API 收集","depth":2},{"value":"节假日","depth":3},{"value":"城市地区划分","depth":3},{"value":"地图","depth":3},{"value":"城市天气","depth":3},{"value":"城市层级 / 天气api的AREAID","depth":3},{"value":"7. node 批量修改 MP3","depth":2},{"value":"8. 多种 NLP 算法收集","depth":2},{"value":"9. 中文样式","depth":2}],"body":"const _excluded = [\"components\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }\n/* @jsx mdx */\n\nconst _frontmatter = {\n  \"slug\": \"codes\",\n  \"title\": \"✨ 偶尔收集的短代码 | Ubug\"\n};\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n  console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n  return mdx(\"div\", props);\n};\nconst layoutProps = {\n  _frontmatter\n};\nconst MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  let {\n      components\n    } = _ref,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", null, \"1. \\u6839\\u636E hex \\u80CC\\u666F\\u989C\\u8272\\u8BA1\\u7B97\\u524D\\u666F\\u6587\\u5B57\\u989C\\u8272\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, \"// \\u8BA1\\u7B97\\u51FA\\u7ECF\\u9A8C\\u7070\\u5EA6\\u503C\\uFF0C\\u7136\\u540E\\u53CD\\u8272\\u4F5C\\u4E3A\\u6587\\u5B57\\u989C\\u8272\\nconst getTextColorFromHex = (bgColor) => {\\n  if (/^#([0-9a-f-A-F]{3}|[0-9a-f-A-F]{6})$/.test(bgColor))\\n    return bgColor\\n      .replace(/^#/, \\\"\\\")\\n      .replace(/^\\\\w+$/, c =>\\n        c.length == 3\\n          ? c\\n            .split(\\\"\\\")\\n            .map(c => c.repeat(2))\\n            .join(\\\"\\\")\\n          : c\\n      )\\n      .match(/\\\\w{2}/g)\\n      .map(hexV => parseInt(hexV, 16))\\n      .reduce((t, v, i) => t + [0.299, 0.587, 0.114][i] * v, 0) /\\n      255 >\\n      0.5\\n      ? \\\"#000\\\"\\n      : \\\"#fff\\\"\\n  else\\n    return '#fff'\\n}\\n\")), mdx(\"h2\", null, \"2. SSL\"), mdx(\"h3\", null, \"\\u5FEB\\u901F\\u751F\\u6210\\u4E00\\u4E2A\\u672C\\u5730 SSL \\u8BC1\\u4E66\\u7528\\u6765\\u8C03\\u8BD5\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bash\"\n  }, \"openssl req -x509 -nodes -new -sha256 -days 1024 -newkey rsa:2048 -keyout localhost.key -out localhost.pem -subj \\\"/C=US/CN=Example-Root-CA\\\"\\nopenssl x509 -outform pem -in localhost.pem -out localhost.crt\\n\")), mdx(\"p\", null, \"mkcert \\u53EF\\u4EE5\\u547D\\u4EE4\\u884C\\u672C\\u5730\\u7B7E\\u53D1https\\u8BC1\\u4E66\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"mkcert --install\\nmkcert *.example.com\\n\")), mdx(\"h3\", null, \"\\u5FEB\\u901F\\u914D\\u7F6E\\u7F51\\u7AD9 SSL\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"\\u514D\\u8D39\\u8BC1\\u4E66\\u9881\\u53D1\\u673A\\u6784 \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://letsencrypt.org/zh-cn/\"\n  }, \"Let\\u2019s Encrypt\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"\\u63A8\\u8350\\xA0ACME \\u5BA2\\u6237\\u7AEF \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://certbot.eff.org/\"\n  }, \"Certbot\"))), mdx(\"h2\", null, \"3. canvas \\u5706\\u89D2\\u77E9\\u5F62\\u3001\\u5706\\u89D2\\u56FE\\u7247\\u3001\\u591A\\u884C\\u6587\\u5B57\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, \"const roundRect = (ctx, x, y, w, h, r) => {\\n  var min_size = Math.min(w, h);\\n  if (r > min_size / 2) r = min_size / 2;\\n  ctx.moveTo(x + r, y);\\n  ctx.arcTo(x + w, y, x + w, y + h, r);\\n  ctx.arcTo(x + w, y + h, x, y + h, r);\\n  ctx.arcTo(x, y + h, x, y, r);\\n  ctx.arcTo(x, y, x + w, y, r);\\n}\\nconst roundImage = (ctx, image, x, y, w, h, r) => {\\n  ctx.save()\\n  ctx.beginPath();\\n  roundRect(ctx, x, y, w, h, r);\\n  ctx.clip()\\n  ctx.closePath();\\n  ctx.drawImage(image, 0, 0, image.width, image.height, x, y, w, h);\\n  ctx.restore()\\n}\\nconst drawText = (ctx, text, x, y, maxWidth, lineHeight) => {\\n  let arrText = text.split('');\\n  let line = '';\\n  for (let n = 0; n < arrText.length; n++) {\\n    let testLine = line + arrText[n];\\n    let metrics = ctx.measureText(testLine);\\n    let testWidth = metrics.width;\\n    if (testWidth > maxWidth && n > 0) {\\n      ctx.fillText(line, x, y);\\n      line = arrText[n];\\n      y += lineHeight;\\n    } else {\\n      line = testLine;\\n    }\\n  }\\n  ctx.fillText(line, x, y);\\n  return y + lineHeight\\n}\\n\")), mdx(\"h2\", null, \"4. \\u76F4\\u63A5\\u542F\\u52A8 AS \\u7684\\u6A21\\u62DF\\u5668\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bat\"\n  }, \"@echo off\\nif \\\"%1\\\" == \\\"h\\\" goto begin\\nmshta vbscript:createobject(\\\"wscript.shell\\\").run(\\\"%~nx0 h\\\",0)(window.close)&&exit\\n\\n:begin\\n::\\nD:\\\\android_sdk\\\\emulator\\\\emulator.exe -netdelay none -netspeed full -avd fake_Pixel_3_XL_29\\n\\n\")), mdx(\"h2\", null, \"5. \\u76F4\\u63A5\\u9759\\u9ED8\\u542F\\u52A8 scrcpy\\uFF0C\\u540C\\u65F6\\u6307\\u5B9A\\u67D0\\u4E2A\\u8BBE\\u5907\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-bat\"\n  }, \"@echo off\\nif \\\"%1\\\" == \\\"h\\\" goto begin\\nmshta vbscript:createobject(\\\"wscript.shell\\\").run(\\\"%~nx0 h\\\",0)(window.close)&&exit\\n\\n:begin\\n::\\n\\\"D:\\\\Program Files\\\\scrcpy-win64-v1.16\\\\scrcpy.exe\\\" -s a9e8d32c\\n\\n\")), mdx(\"h2\", null, \"6. API \\u6536\\u96C6\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"// \\u5F88\\u591A\\u514D\\u8D39\\u7684\\n// https://api.isoyu.com/\\n\")), mdx(\"h3\", null, \"\\u8282\\u5047\\u65E5\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"// https://github.com/NateScarlet/holiday-cn\\n{\\n    \\\"$schema\\\": \\\"https://raw.githubusercontent.com/NateScarlet/holiday-cn/master/schema.json\\\",\\n    \\\"$id\\\": \\\"https://raw.githubusercontent.com/NateScarlet/holiday-cn/master/2022.json\\\",\\n    \\\"year\\\": 2022,\\n    \\\"papers\\\": [\\n        \\\"http://www.gov.cn/zhengce/content/2021-10/25/content_5644835.htm\\\"\\n    ],\\n    \\\"days\\\": [\\n        {\\n            \\\"name\\\": \\\"\\u5143\\u65E6\\\",\\n            \\\"date\\\": \\\"2022-01-01\\\",\\n            \\\"isOffDay\\\": true\\n        },\\n        {\\n            \\\"name\\\": \\\"\\u5143\\u65E6\\\",\\n            \\\"date\\\": \\\"2022-01-02\\\",\\n            \\\"isOffDay\\\": true\\n        }\\n    ]\\n}\\n        \\n\")), mdx(\"h3\", null, \"\\u57CE\\u5E02\\u5730\\u533A\\u5212\\u5206\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"// https://github.com/modood/Administrative-divisions-of-China\\n[\\n  {\\\"code\\\":\\\"110101\\\",\\\"name\\\":\\\"\\u4E1C\\u57CE\\u533A\\\",\\\"cityCode\\\":\\\"1101\\\",\\\"provinceCode\\\":\\\"11\\\"},\\n  {\\\"code\\\":\\\"110102\\\",\\\"name\\\":\\\"\\u897F\\u57CE\\u533A\\\",\\\"cityCode\\\":\\\"1101\\\",\\\"provinceCode\\\":\\\"11\\\"},\\n]\\n\")), mdx(\"h3\", null, \"\\u5730\\u56FE\"), mdx(\"p\", null, \"\\u8FD9\\u4E9B\\u7F51\\u7AD9\\u53EF\\u4EE5\\u5E2E\\u4F60\\u4E0B\\u8F7D\\u9AD8\\u6E05\\u5730\\u56FE\\uFF1A\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"\\u5929\\u5730\\u56FE\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/ExBUXJi%EF%BC%8C%E5%AE%98%E6%96%B9%E5%87%BA%E5%93%81%E7%9A%84%E5%9C%B0%E7%90%86%E4%BF%A1%E6%81%AF%E5%B9%B3%E5%8F%B0%EF%BC%8C%E5%8A%9F%E8%83%BD%E4%B8%B0%E5%AF%8C%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E9%AB%98%E6%B8%85%E5%8D%AB%E6%98%9F%E5%BD%B1%E5%83%8F%EF%BC%8C%E6%94%AF%E6%8C%81%E8%87%AA%E5%AE%9A%E4%B9%89%E5%88%B6%E5%9B%BE%E3%80%82\"\n  }, \"http://t.cn/ExBUXJi\\uFF0C\\u5B98\\u65B9\\u51FA\\u54C1\\u7684\\u5730\\u7406\\u4FE1\\u606F\\u5E73\\u53F0\\uFF0C\\u529F\\u80FD\\u4E30\\u5BCC\\uFF0C\\u53EF\\u4EE5\\u770B\\u5230\\u9AD8\\u6E05\\u536B\\u661F\\u5F71\\u50CF\\uFF0C\\u652F\\u6301\\u81EA\\u5B9A\\u4E49\\u5236\\u56FE\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"\\u6807\\u51C6\\u5730\\u56FE\\u670D\\u52A1\\u7CFB\\u7EDF\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/EoaIdLS%EF%BC%8C%E7%9B%AE%E5%89%8D%E5%8F%91%E5%B8%83%E7%9A%84%E6%A0%87%E5%87%86%E5%9C%B0%E5%9B%BE%E5%8C%85%E6%8B%AC%E4%B8%AD%E5%9B%BD%E5%9C%B0%E5%9B%BE249%E5%B9%85%E3%80%81%E4%B8%96%E7%95%8C%E5%9C%B0%E5%9B%BE79%E5%B9%85%E3%80%81%E4%B8%93%E9%A2%98%E5%9C%B0%E5%9B%BE10%E5%B9%85%EF%BC%8C%E6%8F%90%E4%BE%9BJPG%E3%80%81EPS%E4%B8%A4%E7%A7%8D%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%85%8D%E8%B4%B9%E6%B5%8F%E8%A7%88%E5%92%8C%E4%B8%8B%E8%BD%BD%E3%80%82\"\n  }, \"http://t.cn/EoaIdLS\\uFF0C\\u76EE\\u524D\\u53D1\\u5E03\\u7684\\u6807\\u51C6\\u5730\\u56FE\\u5305\\u62EC\\u4E2D\\u56FD\\u5730\\u56FE249\\u5E45\\u3001\\u4E16\\u754C\\u5730\\u56FE79\\u5E45\\u3001\\u4E13\\u9898\\u5730\\u56FE10\\u5E45\\uFF0C\\u63D0\\u4F9BJPG\\u3001EPS\\u4E24\\u79CD\\u6570\\u636E\\u683C\\u5F0F\\uFF0C\\u53EF\\u4EE5\\u514D\\u8D39\\u6D4F\\u89C8\\u548C\\u4E0B\\u8F7D\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Datav\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/A6xihfSm%EF%BC%8C%E5%9C%B0%E5%9B%BE%E7%94%9F%E6%88%90%E5%99%A8%EF%BC%8C%E6%94%AF%E6%8C%81%E4%B8%8B%E8%BD%BD%E5%90%84%E7%9C%81%E3%80%81%E5%B8%82%E3%80%81%E5%8E%BF%E7%9A%84svg%E6%A0%BC%E5%BC%8F%E7%9A%84%E5%9C%B0%E5%9B%BE%E7%B4%A0%E6%9D%90%E3%80%82\"\n  }, \"http://t.cn/A6xihfSm\\uFF0C\\u5730\\u56FE\\u751F\\u6210\\u5668\\uFF0C\\u652F\\u6301\\u4E0B\\u8F7D\\u5404\\u7701\\u3001\\u5E02\\u3001\\u53BF\\u7684svg\\u683C\\u5F0F\\u7684\\u5730\\u56FE\\u7D20\\u6750\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"\\u56FD\\u5BB6\\u5730\\u7403\\u7CFB\\u7EDF\\u79D1\\u5B66\\u6570\\u636E\\u4E2D\\u5FC3\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/RHiUELQ%EF%BC%8C%E6%8F%90%E4%BE%9B%E4%B8%B0%E5%AF%8C%E7%9A%84%E6%B0%94%E6%B8%A9%E3%80%81%E5%9C%B0%E5%BD%A2%E3%80%81%E9%99%8D%E6%B0%B4%E3%80%81%E5%9C%B0%E8%B4%A8%E7%AD%89%E5%9B%BE%E5%BA%93%E8%B5%84%E6%BA%90%E3%80%82\"\n  }, \"http://t.cn/RHiUELQ\\uFF0C\\u63D0\\u4F9B\\u4E30\\u5BCC\\u7684\\u6C14\\u6E29\\u3001\\u5730\\u5F62\\u3001\\u964D\\u6C34\\u3001\\u5730\\u8D28\\u7B49\\u56FE\\u5E93\\u8D44\\u6E90\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Earth\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/RqkilAV%EF%BC%8C%E5%AE%9E%E6%97%B6%E6%A8%A1%E6%8B%9F%E5%85%A8%E7%90%83%E9%A3%8E%E5%90%91%E3%80%81%E6%B4%8B%E6%B5%81%E3%80%81%E5%A4%A9%E6%B0%94%E6%95%88%E6%9E%9C%EF%BC%8C%E8%BF%99%E4%B8%AA%E7%BD%91%E7%AB%99%E7%9A%84%E5%8F%AF%E8%A7%86%E5%8C%96%E6%95%88%E6%9E%9C%E3%80%81%E9%85%8D%E8%89%B2%E9%83%BD%E9%9D%9E%E5%B8%B8%E7%BB%9D%E3%80%82\"\n  }, \"http://t.cn/RqkilAV\\uFF0C\\u5B9E\\u65F6\\u6A21\\u62DF\\u5168\\u7403\\u98CE\\u5411\\u3001\\u6D0B\\u6D41\\u3001\\u5929\\u6C14\\u6548\\u679C\\uFF0C\\u8FD9\\u4E2A\\u7F51\\u7AD9\\u7684\\u53EF\\u89C6\\u5316\\u6548\\u679C\\u3001\\u914D\\u8272\\u90FD\\u975E\\u5E38\\u7EDD\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"\\u5168\\u7403\\u5149\\u6C61\\u67D3\\u5730\\u56FE\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/A66d5TQ1%EF%BC%8C%E4%BB%8E%E9%AB%98%E7%A9%BA%E8%A7%92%E5%BA%A6%E8%A7%82%E7%9C%8B%E5%85%A8%E7%90%83%E7%9A%84%E7%81%AF%E5%85%89%E5%88%86%E5%B8%83%E6%83%85%E5%86%B5%E3%80%82\"\n  }, \"http://t.cn/A66d5TQ1\\uFF0C\\u4ECE\\u9AD8\\u7A7A\\u89D2\\u5EA6\\u89C2\\u770B\\u5168\\u7403\\u7684\\u706F\\u5149\\u5206\\u5E03\\u60C5\\u51B5\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"NB Maps\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/A66tSaJW%EF%BC%8C%E5%BF%AB%E9%80%9F%E7%94%9F%E6%88%90%E4%B8%89%E7%BB%B4%E5%9C%B0%E5%9B%BE%E7%9A%84%E5%85%8D%E8%B4%B9%E5%B7%A5%E5%85%B7%EF%BC%8C%E5%8F%AF%E4%BB%A5%E8%B0%83%E6%95%B4%E9%A2%9C%E8%89%B2%E3%80%81%E4%BF%AE%E6%94%B9%E5%9C%B0%E5%9B%BE%E7%9A%84%E5%8E%9A%E5%BA%A6%E5%92%8C%E8%A7%92%E5%BA%A6%E3%80%81%E6%9B%B4%E6%8D%A2%E5%AD%97%E4%BD%93%E7%9A%84%E6%A0%B7%E5%BC%8F%EF%BC%8C%E5%8F%AF%E4%B8%8B%E8%BD%BD%E3%80%82\"\n  }, \"http://t.cn/A66tSaJW\\uFF0C\\u5FEB\\u901F\\u751F\\u6210\\u4E09\\u7EF4\\u5730\\u56FE\\u7684\\u514D\\u8D39\\u5DE5\\u5177\\uFF0C\\u53EF\\u4EE5\\u8C03\\u6574\\u989C\\u8272\\u3001\\u4FEE\\u6539\\u5730\\u56FE\\u7684\\u539A\\u5EA6\\u548C\\u89D2\\u5EA6\\u3001\\u66F4\\u6362\\u5B57\\u4F53\\u7684\\u6837\\u5F0F\\uFF0C\\u53EF\\u4E0B\\u8F7D\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Windy\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/A66d5TQB%EF%BC%8C%E5%8F%AF%E8%A7%86%E5%8C%96%E7%9A%84%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5%E7%BD%91%E7%AB%99%EF%BC%8C%E5%8A%9F%E8%83%BD%E5%85%A8%E4%B8%94%E5%85%8D%E8%B4%B9%EF%BC%8C%E8%BF%98%E6%9C%89%E6%B0%94%E5%8E%8B%E3%80%81%E9%A3%8E%E5%8A%9B%E3%80%81%E6%B5%B7%E6%B5%AA%E7%AD%89%E8%AF%A6%E7%BB%86%E5%9B%BE%E5%B1%82%E3%80%82\"\n  }, \"http://t.cn/A66d5TQB\\uFF0C\\u53EF\\u89C6\\u5316\\u7684\\u5929\\u6C14\\u9884\\u62A5\\u7F51\\u7AD9\\uFF0C\\u529F\\u80FD\\u5168\\u4E14\\u514D\\u8D39\\uFF0C\\u8FD8\\u6709\\u6C14\\u538B\\u3001\\u98CE\\u529B\\u3001\\u6D77\\u6D6A\\u7B49\\u8BE6\\u7EC6\\u56FE\\u5C42\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"\\u4E2D\\u56FD\\u5386\\u53F2\\u5730\\u56FE\\u96C6\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/RfhOIAl%EF%BC%8C%E4%B8%80%E4%B8%AA%E5%8E%86%E5%8F%B2%E5%9C%B0%E5%9B%BE%E7%BD%91%E7%AB%99%EF%BC%8C%E5%8F%AF%E6%8C%89%E5%B9%B4%E4%BB%BD%E3%80%81%E5%B9%B4%E5%8F%B7%E6%9F%A5%E8%AF%A2%E3%80%82\"\n  }, \"http://t.cn/RfhOIAl\\uFF0C\\u4E00\\u4E2A\\u5386\\u53F2\\u5730\\u56FE\\u7F51\\u7AD9\\uFF0C\\u53EF\\u6309\\u5E74\\u4EFD\\u3001\\u5E74\\u53F7\\u67E5\\u8BE2\\u3002\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"\\u8BD7\\u4EBA\\u5730\\u7406\\u5206\\u5E03\\u4FE1\\u606F\\uFF1A\", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"http://t.cn/ESIy0mp%EF%BC%8C%E5%8E%86%E4%BB%A3%E8%AF%97%E4%BA%BA%E5%9C%B0%E5%9F%9F%E5%88%86%E5%B8%83%EF%BC%8C%E5%8F%AF%E6%9F%A5%E7%9C%8B%E8%AF%97%E4%BA%BA%E4%B8%80%E7%94%9F%E7%9A%84%E8%BD%A8%E8%BF%B9\"\n  }, \"http://t.cn/ESIy0mp\\uFF0C\\u5386\\u4EE3\\u8BD7\\u4EBA\\u5730\\u57DF\\u5206\\u5E03\\uFF0C\\u53EF\\u67E5\\u770B\\u8BD7\\u4EBA\\u4E00\\u751F\\u7684\\u8F68\\u8FF9\"), \" \\u3002\"))), mdx(\"h3\", null, \"\\u57CE\\u5E02\\u5929\\u6C14\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"// http://image.data.cma.cn/static/doc/market/China_SURF_Station.xlsx \\u5168\\u90E8\\u7684\\u6C14\\u8C61\\u7AD9ID\\u5BF9\\u5E94\\u5173\\u7CFB\\uFF0C\\u5E26 GPS\\n// http://www.nmc.cn/rest/position \\u83B7\\u53D6 station, url \\u548C\\u57CE\\u5E02\\u5730\\u533A  \\n// http://www.nmc.cn/rest/weather?stationid=54399 station \\u7684\\u8BE6\\u60C5  \\n// http://m.nmc.cn/publish/forecast/ABJ/beijing.html \\u6CA1\\u6709\\u5C0F\\u65F6\\u9884\\u62A5\\uFF0C\\u53EA\\u80FD\\u66F2\\u7EBF\\u5339\\u914D  \\n// http://weather.cma.cn/api/weather/view \\u65E0\\u9700 stationid\\uFF0C\\u652F\\u6301 jsonp , ?callback=x&stationid=&_=\\n// 'http://image.nmc.cn/assets/img/w/40x40/4/${response.data!['weather']['img']}.png' \\u56FE\\u6807\\n\\n// \\u5168\\u7403\\u5929\\u6C14\\nhttps://worldweather.wmo.int/zh/dataguide.html\\n\\n// \\u5168\\u7403\\u57CE\\u5E02id+GPS\\n// https://worldweather.wmo.int/zh/json/Country_zh.xml\\n// https://worldweather.wmo.int/zh/json/234_zh.xml \\u67D0\\u4E2A\\u57CE\\u5E02\\u7684\\u9884\\u62A5\\n// https://worldweather.wmo.int/zh/json/present.xml \\u5168\\u7403\\u5B9E\\u65F6\\u5929\\u6C14\\n// 'https://worldweather.wmo.int/images/${'i'}${icon}${(icon >= 21 && icon <= 25) ? 'a' : ''}.png' \\u56FE\\u6807\\u7CFB\\u7EDF\\n\")), mdx(\"h3\", null, \"\\u57CE\\u5E02\\u5C42\\u7EA7 / \\u5929\\u6C14api\\u7684AREAID\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-json\"\n  }, \"// https://e.weather.com.cn/chunyun/js/city.js\\n{\\n  \\\"\\u5317\\u4EAC\\\": {\\n    \\\"\\u5317\\u4EAC\\\": {\\n      \\\"\\u5317\\u4EAC\\\": {\\n        \\\"AREAID\\\": \\\"101010100\\\",\\n        \\\"NAMECN\\\": \\\"\\u5317\\u4EAC\\\"\\n      },\\n      \\\"\\u6D77\\u6DC0\\\": {\\n        \\\"AREAID\\\": \\\"101010200\\\",\\n        \\\"NAMECN\\\": \\\"\\u6D77\\u6DC0\\\"\\n      },\\n      \\\"\\u671D\\u9633\\\": {\\n        \\\"AREAID\\\": \\\"101010300\\\",\\n        \\\"NAMECN\\\": \\\"\\u671D\\u9633\\\"\\n      },\\n      // ...\\n    }\\n    // ...\\n  }\\n  // ...\\n}\\n\")), mdx(\"h2\", null, \"7. node \\u6279\\u91CF\\u4FEE\\u6539 MP3\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, \"var fs = require('fs')\\nvar path = require('path')\\nconst NodeID3 = require('node-id3')\\n\\nconst dir = fs.readdirSync(__dirname)\\nconst files = dir.filter(f => !/(js)|(node)$/.test(f))\\n\\nfiles.forEach(file => {\\n\\n    let s = 0\\n    let e = 0\\n\\n    const match1 = file.match(/S(\\\\d+)E(\\\\d+)/)\\n    const match2 = file.match(/Season(\\\\d+)Episode(\\\\d+)/)\\n\\n    if (match1) {\\n        s = match1[1].padStart(2, '0')\\n        e = match1[2].padStart(2, '0')\\n    } else if (match2) {\\n        s = match2[1].padStart(2, '0')\\n        e = match2[2].padStart(2, '0')\\n    }\\n\\n    const name = `TBBT S${s}E${e}`\\n    const filepath = path.join(__dirname, file)\\n\\n    const tags = { title: name }\\n    const success = NodeID3.write(tags, filepath)\\n\\n    // fs.renameSync(filepath, path.join(__dirname, `${name}.mp3`))\\n    console.log(path.join(__dirname, `TBBT_S${s}E${e}.mp3`), success)\\n})\\n\")), mdx(\"h2\", null, \"8. \\u591A\\u79CD NLP \\u7B97\\u6CD5\\u6536\\u96C6\"), mdx(\"p\", null, \"\\u804A\\u5929\\u673A\\u5668\\u4EBA\\u3001\\u8BED\\u97F3\\u8BC6\\u522B\\u3001OCR\\u3001\\u8BCD\\u5E93\\u7B49\\uFF0C\\u8FD8\\u6709\\u810F\\u8BDD\\u3001\\u654F\\u611F\\u8BCD\\u68C0\\u6D4B\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"https://www.giters.com/fighting41love/funNLP\\n\")), mdx(\"h2\", null, \"9. \\u4E2D\\u6587\\u6837\\u5F0F\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-css\"\n  }, \".post {\\n    font-family: 'chinese quotation marks','opensans regular','helvetica neue',Helvetica,'noto sans sc','microsoft yahei',\\u5FAE\\u8F6F\\u96C5\\u9ED1,STXihei,\\u534E\\u6587\\u7EC6\\u9ED1,Arial,sans-serif;\\n    /* Roboto,San Francisco,\\\"Helvetica Neue\\\",Helvetica,Arial,PingFangSC-Light,\\\"Hiragina Sans GB\\\",\\\"WenQuanYi Micro Hei\\\",'microsoft yahei ui','microsoft yahei',sans-serif */\\n    /* HanHei SC,PingHei,PingFang SC,STHeitiSC-Light,Helvetica Neue,Helvetica,Arial,sans-serif*/\\n    font-size: 16px;\\n    line-height: 28px;\\n    letter-spacing: 1px;\\n    -webkit-font-smoothing: antialiased;\\n    -webkit-text-stroke-width: .2px;\\n}\\n\")), mdx(\"ol\", {\n    \"start\": 10\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"\\u8001\\u65E7\\u9879\\u76EE webpack \\u7684 node-sass \\u4F9D\\u8D56\\u5904\\u7406\")), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"node-sass\"), \" \\u548C \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"NodeJs\"), \" \\u7248\\u672C\\u5F3A\\u76F8\\u5173\\uFF0C\\u8FD8\\u8981\\u7528 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"windows-build-tool\"), \" \\u8981\\u6709 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"python2\"), \" \\u7B49\\u4F9D\\u8D56\\uFF0C\\u5728\\u65B0\\u7248 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"NodeJs\"), \" \\u91CC\\u9762\\u5DF2\\u7ECF\\u6CA1\\u6CD5\\u4F7F\\u7528\\u4E86\\u3002\\u4F46\\u662F\\u8001\\u65E7\\u9879\\u76EE\\u8FD8\\u60F3\\u8FD0\\u884C\\u7684\\u8BDD\\uFF0C\\u9700\\u8981\\u4F7F\\u7528 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sass-loader\"), \" \\u7684 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"options\"), \" \\u4E2D\\u7684 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"implementation\"), \" \\u5C5E\\u6027\\u5207\\u5230 \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"dart-sass\"), \"\\u3002\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, \"const webpackConfig = {\\n  //...\\n  rules: [\\n    {\\n      loader: 'sass-loader',\\n      options: { implementation: require('sass'), sourceMap: true }\\n    }\\n  ]\\n  //...\\n}\\n\")), mdx(\"p\", null, \"\\u4E00\\u4E9B\\u5305\\u88C5\\u7684 config \\u4E5F\\u53EF\\u4EE5\\u7528 webpack-chain \\u5904\\u7406\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-js\"\n  }, \"// \\u8FD9\\u4E2A\\u53C2\\u6570\\u9700\\u8981\\u6839\\u636Econsole\\u51FA\\u6765\\u7684\\u6570\\u636E\\u7ED3\\u6784\\u6765\\u505A\\uFF0C\\u8DDF\\u7248\\u672C\\u53F7\\u6709\\u5173\\u7CFB\\n// \\u53C2\\u8003\\uFF1Ahttps://github.com/XHMM/taro-plugin-dart-sass/blob/master/src/index.ts\\n// console.log(chain.toConfig().module.rules[0])\\n// console.log(chain.toConfig().module.rules[0].use)\\n// console.log(chain.toConfig().module.rules[0].use[1])\\nchain.module.rule('sass').use('1').loader('sass-loader').options({\\n\\xA0 // @ts-ignore\\n\\xA0 implementation: require('sass'),\\n});\\n\")));\n}\n;\nMDXContent.isMDXComponent = true;"}}]}},"pageContext":{"isCreatedByStatefulCreatePages":true}}}